﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MathLib
{
    public class Methods
    {
        public static double ArithmeticMean(params double[] vals)
        {
            if(vals == null || vals.Length == 0)
            {
                return 0;
            }

            double sum = 0;
            foreach(double val in vals)
            {
               sum += val;
            }

            return sum / vals.Length;
        }

        private static double NthRoot(double x, int n)
        {
            return 0;
        }

        public double GeometricMean(params double[] vals)
        {
            if(vals == null || vals.Length == 0)
            {
                return 0;
            }

            double sum = 1;
            foreach(double val in vals)
            {
                sum *= val;
            }

            return Math.Pow(sum, 1.0 / vals.Length);
        }

        public static double HarmonicMean(params double[] vals)
        {
            //\
            throw new NotImplementedException("Not implemented!!");
        }
    }
}
